﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BTS.Common
{
    public static class FilePaths
    {
        private static string _ConfigFilePath = Directory.GetCurrentDirectory() + "\\ConfigFile\\";
        public static string ConfigFilePath
        {
            get
            {
                if (string.IsNullOrEmpty(_ConfigFilePath))
                {
                    _ConfigFilePath = Directory.GetCurrentDirectory() + "\\ConfigFile\\";
                }
                //if (!Directory.Exists(_ConfigFilePath))
                //{
                //    Directory.CreateDirectory(_ConfigFilePath);
                //}
                return _ConfigFilePath;
            }
        }

        private static string _DataBasePath = ConfigFilePath + "\\DataBase.db";
        /// <summary>
        /// 系统配置文件路径
        /// </summary>
        public static string DataBasePath
        {
            get
            {
                if (string.IsNullOrEmpty(_DataBasePath))
                {
                    _DataBasePath = _ConfigFilePath + "\\DataBase.db";
                }
                //if (!Directory.Exists(Path.GetDirectoryName( _DataBasePath)))
                //{
                //    Directory.CreateDirectory(Path.GetDirectoryName(_DataBasePath));
                //}
                return _DataBasePath;
            }
        }

        private static string _SystemConfig = ConfigFilePath + "SystemConfig.json";
        /// <summary>
        /// 系统配置文件路径
        /// </summary>
        public static string SystemConfig
        {
            get
            {
                if (!File.Exists(_SystemConfig))
                {
                    File.Create(_SystemConfig).Close();
                }
                return _SystemConfig;
            }
        }


        private static string _FirmwareConfig = ConfigFilePath + "\\Firmware\\";
        /// <summary>
        /// 固件放置位置
        /// </summary>
        public static string FirmwareConfig
        {
            get
            {
                if (string.IsNullOrEmpty(_HelpDecomentPath))
                {
                    _FirmwareConfig = Directory.GetCurrentDirectory() + "\\Firmware\\";
                }
                return _FirmwareConfig;
            }
        }


        private static string _HelpDecomentPath = Directory.GetCurrentDirectory() + "\\Help\\";
        /// <summary>
        /// 帮助文档放置位置
        /// </summary>
        public static string HelpDecomentPath
        {
            get
            {
                if (string.IsNullOrEmpty(_HelpDecomentPath))
                {
                    _HelpDecomentPath = Directory.GetCurrentDirectory() + "\\Help\\";
                }
                //if (!Directory.Exists(_HelpDecomentPath))
                //{
                //    Directory.CreateDirectory(_HelpDecomentPath);
                //}
                return _HelpDecomentPath;
            }
        }

        private static string _LogConfig = ConfigFilePath + "\\Log\\";
        /// <summary>
        /// Log放置位置
        /// </summary>
        public static string LogConfig
        {
            get
            {
                if (string.IsNullOrEmpty(_LogConfig))
                {
                    _LogConfig = Directory.GetCurrentDirectory() + "\\Log\\";
                }
                //if (!Directory.Exists(_LogConfig))
                //{
                //    Directory.CreateDirectory(_LogConfig);
                //}
                return _LogConfig;
            }
        }


        private static string _DefultSoftwareIcon = ConfigFilePath + "Logo.png";
        public static string DefultSoftwareIcon
        {
            get { return _DefultSoftwareIcon; }
        }
    }
}
